import { Image, StyleSheet, Text, View } from 'react-native'
import React, { useEffect, useState } from 'react'
import { Button, Toast } from '@ant-design/react-native'
import { router } from 'expo-router'
import AsyncStorage from '@react-native-async-storage/async-storage'

const CameraRes = () => {
    const [image, setImage] = useState<string | null>(null);
    const getPic = async () => {
        await AsyncStorage.getItem('pic').then(res => {
            setImage(res)
        })

    }
    useEffect(() => {
        getPic()
    }, [])
    return (
        <View style={styles.container}>
            {image && <Image source={{ uri: image }} style={styles.image} />}
            <Button type='primary' onPress={() => { router.push('/userInfo');Toast.success('修改成功') }}>保存</Button>
        </View>
    )
}

export default CameraRes

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    image: {
        width: 400,
        height:600,
    },
})